﻿<ion-header>
    <ion-navbar>
        <ion-title>
            用户中心
        </ion-title>
    </ion-navbar>
</ion-header>

<ion-content>
    <ion-list>
        <ion-item *ngIf="userProvider.localStorage" (click)="gotoUserInfoPage()">
            <ion-avatar item-left>
                <img width="300" height="300" src="{{userProvider.avatar}}" onError="this.src='assets/img/avatar.png'">
            </ion-avatar>
            <h2>{{userProvider.username}}</h2>
            <h3 *ngIf="deviceProvider.devices">{{userProvider.deviceList.length}}个设备已接入</h3>
            <ion-note item-right>编辑</ion-note>
        </ion-item>
        <ion-item *ngIf="!userProvider.username">
            <div>无法连接到服务器，请确认网络是否可用</div>
        </ion-item>
    </ion-list>
    <b-item [icon]="'device'" [content]="'设备管理'" (click)="goto('UserDevicesPage')"></b-item>
    <b-item [icon]="'scene'" [content]="'场景设置'" (click)="goto('UserScenePage')"></b-item>
    <!-- <b-item class="disable" [icon]="'scene'" [content]="'场景设置'"></b-item> -->
    <b-item class="disable" [icon]="'auto'" [content]="'自动化管理'"></b-item>
    <b-item [icon]="'devtool'" [content]="'开发工具'" (click)="goto('UserDevtoolPage')"></b-item>
    <b-item [icon]="'setting'" [content]="'应用设置'" (click)="goto('UserSettingsPage')"></b-item>
    <div class="other">
        <div text-center class="version" (tap)="checkUpdate()">
            <div>当前版本：{{softVersion}}</div>
            <img *ngIf="showNew" class="cue" src="assets/img/new.png">
        </div>
        <p text-center class="logout">
            <button ion-button button-clear-outline block round outline (click)="logout()">退出登录</button>
        </p>
    </div>
</ion-content>